Add ISO_TIME_MS to Style formats.
authorrobertl <robertl>
Thu, 5 Jul 2007 01:42:58 +0000 (01:42 +0000)
committerrobertl <robertl>
Thu, 5 Jul 2007 01:42:58 +0000 (01:42 +0000)
csv_util.c
xmldoc/chapters/styles.xml

index 3baa9187ecd72bd6e6c010fc4916b9d1478b358b..e3389376f4850dec55d3e80ce4d5e4653b52bbf6 100644 (file)
@@ -27,6 +27,7 @@
 #include "grtcirc.h"
 #include "strptime.h"
 #include "jeeps/gpsmath.h"
+#include "xmlgeneric.h"  // for xml_fill_in_time.
 
 #define MYNAME "CSV_UTIL"
 
@@ -938,8 +939,9 @@ xcsv_parse_val(const char *s, waypoint *wpt, const field_map_t *fmp)
        (strcmp(fmp->key, "HMSL_TIME") == 0) ) {
        wpt->creation_time += addhms(s, fmp->printfc);
     } else
-    if (strcmp(fmp->key, "ISO_TIME") == 0) {
-       wpt->creation_time = xml_parse_time(s, NULL);
+    if ((strcmp(fmp->key, "ISO_TIME") == 0) || 
+        (strcmp(fmp->key, "ISO_TIME_MS") == 0)) {
+       wpt->creation_time = xml_parse_time(s, &wpt->microseconds);
     } else
        if (strcmp(fmp->key, "GEOCACHE_LAST_FOUND") == 0) {
        wpt->gc_data.last_found = yyyymmdd_to_time(s);
@@ -1457,6 +1459,10 @@ xcsv_waypt_pr(const waypoint *wpt)
        if (strcmp(fmp->key, "ISO_TIME") == 0) {
             writetime(buff, sizeof buff, "%Y-%m-%dT%H:%M:%SZ", wpt->creation_time, 1 );
        } else
+       if (strcmp(fmp->key, "ISO_TIME_MS") == 0) {
+            xml_fill_in_time(buff, wpt->creation_time, 
+               MICRO_TO_MILLI(wpt->microseconds), XML_LONG_TIME);
+       } else
         if (strcmp(fmp->key, "GEOCACHE_LAST_FOUND") == 0) {
            writebuff(buff, fmp->printfc, time_to_yyyymmdd(wpt->gc_data.last_found));
        } else
index ca1c1f27b90a92d36632712f027858ed0a331f5e..199e91b6aff292115206cfd8caab8d6c23c56b55 100644 (file)
@@ -900,6 +900,23 @@ example:
 </screen>
 </section>
  
+<section id="style_def_isotimems">
+<title>ISO_TIME_MS</title>
+<para>
+   ISO_TIME_MS is much like ISO_TIME, but expresses milliseconds at the
+   end of the timestamp.
+   It is thus in the format yyyy-mm-ddThh:mm:ss.SSSzzzzz
+   where 'SSS' is milliseconds and zzzzzz is the local time offset 
+   or the character Z for UTC time.
+   On output, UTC 'Z' time zone will always be used.
+</para>
+<para>
+example:
+</para>
+<screen format="linespecific">   IFIELD ISO_TIME_MS,"","%s"
+</screen>
+</section>
+
 <section id="style_def_geodiff">
 <title>GEOCACHE_DIFF</title>
 <para>